Different Sonar senors (sound navigation and ranging) were tested in additon to the development of the boat. The original goal was to achieve a stable and cost-effective detection of the aquatic bed or river bed morphology. Sonar systems allow a distance determination based on emitted sound pulses. During the project, three active sonars were tested, which themselves emit signals and receive echoes in order to determine the distance based on the runtime. Tests were carried out on land as well as in various areas of the Lahn river.
Image 1 HC-SR04 (from tutorials-raspberrypi.de):
The ultrasonic module HC-SR04 was the first attempt to find a suitable sensor. According to the producer, the module is suitable for distance measurements between two centimetres and a maximum of three metres. The opening angle of the transmitter is 15°. The sensor requires a supply voltage of +5 volts and can easily be connected to a Raspberry via four pins.
Price: around 2 Euro
Examples for hardware setup and code examples:
https://pimylifeup.com/raspberry-pi-distance-sensor/
https://www.youtube.com/watch?v=xACy8l3LsXI
https://tutorials-raspberrypi.de/entfernung-messen-mit-ultraschallsensor-hc-sr04/ (German)
Although the HC-SR04 provides good measurement results, the main problem was to make the sensor waterproof. While there were considerations to dip the sensor in silicone and provide it with a mobile phone protection film in front of the sensor system, this has not been tested until now. Our tests were carried out the following script, taken from https://tutorials-raspberrypi.de/entfernung-messen-mit-ultraschallsensor-hc-sr04/, with the modification “distanz = (TimeElapsed * 34300) / 2 to simulate the runtime for a measurement under water:
#Bibliotheken einbinden
import RPi.GPIO as GPIO
import time
#GPIO Modus (BOARD / BCM)
GPIO.setmode(GPIO.BCM)
#GPIO Pins zuweisen
GPIO_TRIGGER = 18
GPIO_ECHO = 24
#Richtung der GPIO-Pins festlegen (IN / OUT)
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)
def distanz():
# setze Trigger auf HIGH
GPIO.output(GPIO_TRIGGER, True)
# setze Trigger nach 0.01ms aus LOW
time.sleep(0.00001)
GPIO.output(GPIO_TRIGGER, False)
StartZeit = time.time()
StopZeit = time.time()
# speichere Startzeit
while GPIO.input(GPIO_ECHO) == 0:
StartZeit = time.time()
# speichere Ankunftszeit
while GPIO.input(GPIO_ECHO) == 1:
StopZeit = time.time()
# Zeit Differenz zwischen Start und Ankunft
TimeElapsed = StopZeit - StartZeit
# mit der Schallgeschwindigkeit (34300 cm/s) multiplizieren
# und durch 2 teilen, da hin und zurueck
distanz = (TimeElapsed * 34300) / 2
return distanz
if __name__ == '__main__':
try:
while True:
abstand = distanz()
print ("Gemessene Entfernung = %.1f cm" % abstand)
time.sleep(1)
# Beim Abbruch durch STRG+C resetten
except KeyboardInterrupt:
print("Messung vom User gestoppt")
GPIO.cleanup()
Image 2 JSN-SR04T (from raspberrypi-spy.co.uk):
After the first tests with the HR-SR04 module and water resistance problems, the JSN-SR04T “Waterproof Ultrasonic Distance Measuring Module” was chosen. The module also requires +5V as power supply. Measurement distances is accurate about 0.5 cm and the maximum distance is 4.5 meters.
After the first successful tests in the dry, using the same script as the HR-SR04. We had to test, if the sensor is waterproof or splash water proof, as excpected the sensor isn’t build for under water measurement. The sensor is splash water proof but not waterproof. In that time, it was also difficult to attach the sonor to the body of the boat in order to achieve a good vertical depth measurement in the water.
Price: around 18 Euro
Examples for hardware setup and code examples:
Image 3 MB7354 (from maxbotix.com)
The MB7354 “HRXL-MaxSonar-WRS5” was selected as the third test module. One reason for the selection was the weather resistance described by the manufacturer and the robust PVC housing. Actually intended for measuring snow depths, the module is equipped with an internal filter and a temperature sensor. The resolution of the sensor is specified as 1 mm at a maximum range of 5m. As the use under water is not recommended, this sensor was not tested.
Price: 40 $
Further informations and product specifications:
https://www.maxbotix.com/Ultrasonic_Sensors/MB7354.htm
https://www.maxbotix.com/documents/HRXL-MaxSonar-WRS_Datasheet.pdf
Image 4 Deeper Sonar (from deepersonar.com)